package com.qilin.hammer.util;

import java.util.*;
import static com.qilin.hammer.util.Global.*;

public class New {

	public static <K, V> Map<K, V> map(){
		return new HashMap<K,V>();
	}
	
	public static <K, V> Map<K, V> map(String type){
		if(type == null || type.equals(HASH_MAP))
			return new HashMap<K,V>();
		else if(type.equals(TREE_MAP))
			return new TreeMap<K,V>();
		else 
			return new LinkedHashMap<K,V>();
	}
	
	public static <T> List<T> list(){
		return new ArrayList<T>();
	}
	
	public static <T> List<T> list(String type){
		if(type == null || type.equals(ARRAY_LIST))
			return new ArrayList<T>();
		else
			return new LinkedList<T>();
	}
	
	public static <T> Set<T> set(){
		return new HashSet<T>();
	}
	
	public static <T> Set<T> set(String type){
		if(type == null || type.equals(HASH_SET))
			return new HashSet<T>();
		else if(type.equals(TREE_SET))
			return new TreeSet<T>();
		else
			return new LinkedHashSet<T>();
	}
	
	public static <T> Queue<T> queue(){
		return new LinkedList<T>();
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Map<String, String> hashmap=New.map(HASH_MAP);
		Map<String, String> linkedhashmap=New.map(LINKED_HASH_MAP);
		Map<String, String> treemap=New.map(TREE_MAP);
		Map<String, String> defaultmap=New.map();
		System.out.println(hashmap.getClass()+" "+linkedhashmap.getClass()+" "+treemap.getClass()+" "+defaultmap.getClass());
	}

}
